package com.gxs.tga.poc.domain;

import java.io.Serializable;
import java.util.UUID;

import javax.persistence.*;

import com.gxs.tga.poc.domain.dto.TgaSolutionTRDto;


/**
 * The persistent class for the TGA_SOLUTION_TR database table.
 * 
 */
@Entity
@Table(name="TGA_SOLUTION_TR")
@NamedQuery(name="TgaSolutionTR.findAll", query="SELECT t FROM TgaSolutionTR t")
public class TgaSolutionTR implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="TR_RECORD_ID", unique=true, nullable=false, length=36)
	private String trRecordId;

	@Column(name="COMP_ID", nullable=false, length=36)
	private String compId;

	@Column(name="APRF", length=20)
	private String aprf;

	@Column(name="ITINERARY_NAME", length=200, nullable=false)
	private String itineraryName;

	//bi-directional many-to-one association to TgaSolution
	@ManyToOne
	@JoinColumn(name="SOLUTION_ID", nullable=false)
	private TgaSolution tgaSolution;

	public TgaSolutionTR() {
	}
	
	public TgaSolutionTR(TgaSolutionTRDto dto, TgaSolution solution, boolean generateId)
	{
		this.aprf = dto.getAprf();
		this.itineraryName = dto.getItineraryName();
		this.compId = dto.getCompId();
		this.tgaSolution = solution;
		this.trRecordId = dto.getTrRecordId();
		
		if(generateId)
		{
			this.trRecordId = UUID.randomUUID().toString();
		}
	}

	public String getTrRecordId() {
		return this.trRecordId;
	}

	public void setTrRecordId(String trRecordId) {
		this.trRecordId = trRecordId;
	}

	public String getCompId() {
		return this.compId;
	}

	public void setCompId(String compId) {
		this.compId = compId;
	}

	public TgaSolution getTgaSolution() {
		return this.tgaSolution;
	}

	public void setTgaSolution(TgaSolution tgaSolution) {
		this.tgaSolution = tgaSolution;
	}

	public String getAprf()
	{
		return aprf;
	}

	public void setAprf(String aprf)
	{
		this.aprf = aprf;
	}

	public String getItineraryName()
	{
		return itineraryName;
	}

	public void setItineraryName(String itineraryName)
	{
		this.itineraryName = itineraryName;
	}

	
}